home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / Prograph Reference Manual.sit / Prograph Reference Manual / Prograph Reference 8-End.rsrc / TEXT_144.txt < prev    next >
Text File  |  1995-10-26  |  27KB  |  1,073 lines

  1.  
  2. Arguments*536*
  3.  
  4. The arguments of a method consist of as many input arguments as there are terminals and as many output arguments as there are roots on the calling operation.
  5.  
  6. Each four byte input argument is either a handle to a Prograph data item or NULL. 
  7. Each output argument is the address of where a handle to a Prograph data item will be put. If the method does not set the output to a Prograph data handle, it must set it to NULL.
  8.  
  9.  Supplied Functions*536*
  10.  
  11. AddPrimitive *536*
  12.  
  13. Adds a primitive to the Prograph interpreter窶冱 primitives table. In interpreted code AddPrimitive must be called from the main routine once for each external primitive. The first argument is the resource number of the primitive窶冱 associated 'STR#' resource calling operation when created in a Prograph program. The upper byte of the arity is the number of input terminals and the lower byte is the number of output roots. The third argument is a set of flags. All XPrims need to have the value PF_USER set as one of the flags.  If the primitive has variable-arity, the flag PF_VAR should be set. If the calling operation is to be created with a default next-case control, the flag PF_CTRL should be set. Use a bit-or operation to specify multiple flags as shown in the example below. The fourth argument should always be zero. The last argument is the address of the primitive窶冱 code.*536*
  14.  
  15. AddPrimitive  and its arguments are discussed in more detail in the section 窶弩riting XPrims窶 below.
  16.  
  17. Availability:  
  18.  
  19.  Interpreted XPrims
  20.  
  21. Syntax:  *536*
  22.  
  23.  #include "X_includes.h"
  24.  
  25.  void AddPrimitive( nameID, arity, flags, select, code )
  26.  
  27.  Int2 nameID;     /* # of 'STR#' resource with primitive name & info */
  28.  Int2 arity;       /* minimum arity of primitive - four digit hex
  29.          value:  first two hex digits = input arity 
  30.          second two hex digits = output arity */
  31.  Int2 flags;       /* PF_USER = user defined, PF_CTRL = with
  32.          control, PF_VAR = variable arity */
  33.  Int2 select;      /* not used. Should always be 0 */
  34.  ProcPtr code;     /* address of prim's code */
  35.  
  36. Example:  
  37.  
  38.  extern U_point_2D_in_2D_rect_3F_();
  39.  /* assume the primitive point-in-rect? is */ 
  40.  /* defined in a separate file */
  41.  
  42.  void main()
  43.  {
  44.   ...
  45.   AddPrimitive( 3, 0x0200, PF_USER | PF_CTRL | PF_VAR, 0
  46.            &U_point_2D_in_2D_rect_3F_);
  47.   ...
  48.  }
  49.  
  50. Bless *537*
  51.  
  52. Assigns an data item to a particular class. Use this function for data items which have been read from a resource or a data file. Do not use Bless to change a data item窶冱 class arbitrarily. (Bless is not to be confused with the THINK function bless.)
  53.  
  54. Availability:  
  55.  
  56.  XCode
  57.  
  58. Syntax:  
  59.  
  60.  #include "X_includes.h"
  61.  
  62.  void Bless(  object, class )
  63.  
  64.  C_object *object;    /* object to bless (must be a Handle) */
  65.   Class      *class;    /* new class for object */
  66.          /* address of class identifier */
  67.  
  68.  
  69. Example:  
  70.  
  71.  C_object *myObject;
  72.  /* assume myObject contains a handle */
  73.  Bless( myObject, &C_string__ );     
  74.  ...
  75.  
  76. CallPrimitive *537*
  77.  
  78. Calls a Prograph primitive by name in interpreted code. This function is unnecessary in compiled code, since primitives are called directly. Note that there is some overhead involved for the lookup in the table of primitives, and for copying the arguments into and out of the stack. Also, you are responsible for maintaining the use counts of any data items returned by the called primitive.
  79.  
  80. If a primitive of the given name is not found, CallPrimitive returns the value PRIMERR_NAME. If the call to the primitive fails for any other reason, one of the other PRIMERR values is returned. If the error returned is PRIMERR_TYPE or PRIMERR_VALUE, the ordinal value of the offending input is encoded in the least-significant byte of the returned error value. If the value returned is PCF_FALSE or PCF_TRUE, the call to the primitive has succeeded.
  81.  
  82. Availability:   *538*
  83.  
  84.  Interpreted XPrims
  85.  
  86. Syntax:  
  87.  
  88.  #include "MacTypes.h"
  89.  #include "X_includes.h"
  90.  Int2 CallPrimitive( name, arity, args )
  91.  
  92.  Nat1 * name;     /* pascal string holding the primitive's name */
  93.  Int2 arity;     /* actual # of input and output args passed */
  94.  Int4 args;      /* place holder for the actual arguments */
  95.  
  96. Example 1:  
  97.  
  98.  C_real * value;     /* assume that value is a valid C_real */
  99.  C_real * cosine;    /* value returned by call */
  100.  Int2 error;       /* result of the call to the primitive */
  101.  
  102.  error = CallPrimitive( "¥pcos", 0x0101, value, &cosine );
  103.  
  104.  if ( error != PCF_TRUE)
  105.   /* then there is something wrong with your primitive */
  106.  else
  107.  {
  108.   /* use the cosine value and then clean up unneeded values */
  109.   DecUse( value );
  110.   DecUse( cosine );
  111.  }
  112.  
  113. Example 2:    *538*
  114.  
  115.  C_real * input1;       /* a real to be formatted */
  116.  C_real * input2;       /* a real to be formatted */
  117.  C_string * formString; /* format string,eg."¥99.99¥ ¥99.99¥"*/
  118.  C_string * resString;    /* result of format operation */
  119.  Int2 error;        /* result of the call to the primitive */
  120.  
  121.  error = CallPrimitive( "¥pformat", 0x0301, formString, input1,                input2, &resString);
  122.  
  123.  if ( error != PCF_TRUE)
  124.   /* then there is something wrong with your primitive */
  125.  else
  126.  {
  127.   /* formString is finished with */
  128.   DecUse( formString );
  129.   /* if resString is finished with and is not assigned to
  130.     an output or to a list or instance slot */
  131.   DecUse( resString );
  132.  }
  133.  
  134. DecUse *539*
  135.  
  136. Decrements the use field of the given data item by one and, if the use count is zero, releases the memory it occupies. Note that it is not the user窶冱 responsibility to destroy Prograph data items, but only to ensure that use counts are properly maintained.  You should never decrement the use field directly. 
  137.  
  138. Availability:  
  139.  
  140.  Interpreted XPrims, Compiled XPrims, XCode
  141.  
  142. Syntax:  
  143.  
  144.  #include "X_includes.h"
  145.  
  146.  void DecUse( data )
  147.  
  148.  C_object * data;      /* the data item to be decremented */
  149.  
  150. Example:  
  151.  
  152.  C_string * myString; 
  153.      /* assume myString is "abc" and has a use count of 1 */
  154.  DecUse( myString );
  155.      /* myString's use count will be decremented to
  156.       0 & so its memory will be released */
  157.  
  158. Duplicate *539*
  159.  
  160. Copies any of the Prograph data types. The second parameter, SHALLOW_COPY or DEEP_COPY, controls the way in which Duplicate copies complex objects (lists and instances) and simple objects (everything else).  A SHALLOW_COPY returns a copy of a simple object with a use count of one. If the object is complex, the object itself will be copied and the objects in its slots will have their use counts incremented. A DEEP_COPY will copy complex objects to arbitrary depth. Simple objects contained in the complex objects will not be copied, but their use counts will be incremented. 
  161. Copies of active instances of system classes will have their owner fields set to NULL. Active instances of subclasses of C_Menu, C_Window and C_Application will have their active? fields set to FALSE.
  162.  
  163. Availability:  *539*
  164.  
  165.  Interpreted XPrims, Compiled XPrims, XCode
  166.  
  167. Syntax:  
  168.  
  169.  #include "X_includes.h"
  170.  
  171.  C_object * Duplicate( object, mode )
  172.  
  173.  C_object * object;      /* data to be copied */
  174.  CopyMode mode;       /* DEEP_COPY or SHALLOW_COPY */
  175.  
  176. Example:  
  177.  
  178.  C_list * oldData, * newData;
  179.   /* assume that oldData is NULL or a valid data item */
  180.  newData = Duplicate( oldData, SHALLOW_COPY );
  181.   /* the list is copied but the items contained in the
  182.     list just have  their use count incremented */
  183.  
  184. GetTypeName  *540*
  185.  
  186. Takes a data item of any type and returns a C_string with its type, or in the case of an instance of a class, returns the class name. The C_string is returned with use count of one.
  187.  
  188. Availability:  
  189.  
  190.  Interpreted XPrims, Compiled XPrims, XCode
  191.  
  192. Syntax:  
  193.  
  194.  #include "X_includes.h"
  195.  
  196.  void GetTypeName( object, string )
  197.  
  198.  C_object * object;     /* a data item */
  199.  C_string ** string;    /* name of the data type or class */
  200.  
  201. Example:  
  202.  
  203.  C_string *myString;
  204.  C_object *myDataItem;    /* assume myDataItem to be an 
  205.       item of any arbitrary data type */
  206.  GetTypeName( myDataItem, &myString );
  207.  
  208. GetRefLevel *540*
  209.  
  210. Returns the level of indirection of an object:    one if the object is a C_Ptr, two if it is a C_Handle, and zero otherwise.
  211.  
  212. Availability:  
  213.  
  214.  Interpreted XPrims, Compiled XPrims, XCode
  215.  
  216. Syntax:  
  217.  
  218.  #include "X_includes.h"
  219.  
  220.  Nat2 GetRefLevel( object )
  221.  
  222.  C_object *object;    /* the object to be tested */
  223.  
  224.  
  225. Example:  
  226.  
  227.  C_object *input; 
  228.  
  229.  switch ( GetRefLevel( input ) )
  230.  {
  231.   case 0:  
  232.        /* input is direct  */
  233.   case 1:  
  234.    /* input is a C_Ptr */
  235.   case 2:  
  236.    /* input is a C_handle */
  237.  }
  238.  
  239. HasType *541*
  240.  
  241. Determines whether a data item is a given data type, or an indirect reference to that type. For example, HasType( object, C_REGION ) returns TRUE if object is a C_Region, a C_Ptr that points to a region, or a C_Handle that contains a handle to a region. Class identifiers are defined in X_struct_ids.h.
  242.  
  243. In XPrim code HasType窶冱 second parameter, the type, is of the form C_CLASSNAME (all capitals). In XCode the second parameter is the address of a class identifier and has the form &C_classname__  (mixed case). 
  244.  
  245. Availability:  
  246.  
  247.  Interpreted XPrims, Compiled XPrims, XCode
  248.  
  249. Syntax:  *541*
  250.  
  251.  #include "X_includes.h"
  252.  
  253.  Bool HasType( object, type )
  254.  
  255.  C_object *object;    /* the object to be tested */
  256.  Class      *type;     /* the type to check */
  257.  
  258. XPrim Example:  
  259.  
  260.  C_object *input; 
  261.  
  262.  if ( HasType( input, C_REGION ) )
  263.   ...
  264.    /* input is either a C_Region, or a C_Ptr or C_Handle which                       reference a region*/
  265.  
  266. XCode Example:  
  267.  
  268.  C_object *input; 
  269.  
  270.  if ( HasType( input, &C_Region__ ) )
  271.   ...
  272.    /* input is either a C_Region, or a C_Ptr or C_Handle which                       reference a region*/
  273.  
  274. INCLASS *542*
  275.  
  276. INCLASS is a macro which is used to determine the class of a data item.  INCLASS returns TRUE if the data item窶冱 class is equal to the class specified. Unlike Member, INCLASS does not check the ancestors of the data item窶冱 class. In interpreted code IsType must be used in place of INCLASS. 
  277.  
  278. Availability:  
  279.  
  280.  XCode
  281.  
  282. Example:  
  283.  
  284.  C_object *myObject;
  285.  /* Determine whether myObject is a real */
  286.   
  287.  if ( INCLASS( myObject, &C_real__ ) )
  288.    ...
  289.  else
  290.    ...
  291.  
  292. IncUse *542*
  293.  
  294. Increments the use field of the given data item by one.
  295.  
  296. Availability:  
  297.  
  298.  Interpreted XPrims, Compiled XPrims, XCode
  299.  
  300. Syntax:  
  301.  
  302.  #include "X_includes.h"
  303.  
  304.  void IncUse( data )
  305.  
  306.  C_object *data;      /* the data item to be incremented */
  307.  
  308. Example:  
  309.  
  310.  C_string *myString; 
  311.    /* assume myString is "abc" and has a use count of 1 */
  312.  IncUse( myString );
  313.    /* myString's use count will be incremented by 1 */
  314.  OR
  315.  (**myString).use++;
  316.  
  317. IsType *542*
  318.  
  319. Determines whether an object is of a given type. In XCode format the macro INCLASS serves the same function.
  320.  
  321. In XPrim code IsType窶冱 second parameter, the type, is of the form C_CLASSNAME (all capitals). In XCode the second parmeter is the address of a class identifier and has the form &C_classname__  (mixed case). 
  322.  
  323. Availability:  
  324.  
  325.  Interpreted XPrims, Compiled XPrims, XCode
  326.  
  327. Syntax:  
  328.  
  329.  #include "X_includes.h"
  330.  
  331.  Bool IsType( object, type )
  332.  
  333.  C_object *object;    /* the object to be tested */
  334.  Class       *type;     /* the type to check */
  335.  
  336. XPrim Example:  
  337.  
  338.  C_object *input; 
  339.  
  340.  if ( IsType( input, C_STRING ) )
  341.   ...
  342.    /* check to see if input is a string */
  343.  
  344. XCode Example:  
  345.  
  346.  C_object *input; 
  347.  
  348.  if ( IsType( input, &C_string__ ) )
  349.   ...
  350.  
  351.    /* check to see if input is a string */
  352.  
  353. ListDeleteSlot *543*
  354.  
  355. Removes a slot from a C_list data item, thereby shortening the list, and optionally decrements the data item窶冱 use count.
  356.  
  357. Availability:  
  358.  
  359.  Interpreted XPrims, Compiled XPrims, XCode
  360.  
  361. Syntax:  
  362.  
  363.  #include "MacTypes.h"
  364.  #include "X_includes.h"
  365.  
  366.  void ListDeleteSlot( list, index, use )
  367.  
  368.  C_list * list;        /* the list involved */
  369.  Nat4 index;          /* slot in the list; 1st index is 0 */
  370.  Bool use;          /* TRUE = apply DecUse to 
  371.                 any object in the deleted slot */  
  372.  
  373. Example:  
  374.  
  375.  C_list * myList;
  376.     /* assume myList is ( a b c ) */
  377.  ListDeleteSlot( myList, 0, TRUE );
  378.     /* list is now ( b c ) */
  379.  
  380. ListEmptySlot *544*
  381.  
  382. Finds an empty slot (in other words, one whose value is NULL ) in a C_list data item. If no empty slot is found, an empty slot is appended to the end of the list.
  383.  
  384. Availability:  
  385.  
  386.  Interpreted XPrims, Compiled XPrims, XCode
  387.  
  388. Syntax:  
  389.  
  390.  #include "X_includes.h"
  391.  
  392.  void ListEmptySlot( list, index )
  393.  
  394.  C_list * list;       /* the list involved */
  395.  Nat4 * index;        /* 0 based index to the empty slot */
  396.  
  397. Example:  
  398.  
  399.  C_list * myList;
  400.  Nat4 index;
  401.    /* assume myList is ( a b c ) */
  402.  ListEmptySlot( myList, &index );
  403.    /* list is now ( a b c NULL ) and index = 3 */
  404.  
  405. ListGetSlot *544*
  406.  
  407. Returns the contents of the given slot, and optionally increments the use count on the data item returned.
  408.  
  409. Availability:  
  410.  
  411.  Interpreted XPrims, Compiled XPrims, XCode
  412.  
  413. Syntax:  
  414.  
  415.  #include "MacTypes.h"
  416.  #include "X_includes.h"
  417.  
  418.  void ListGetSlot( list, index, use, item )
  419.  
  420.  C_list * list;      /* the list involved */
  421.  Nat2 index;       /* 0 based index to the slot */
  422.  Bool use;        /* TRUE = apply IncUse to the item */
  423.  C_object ** item;     /* address of the data item or NULL 
  424.              if slot empty */
  425.  
  426. Example:  
  427.  
  428.  C_list * myList;
  429.  C_string * myString;
  430.    /* assume myList is ( a b c ) */
  431.  ListGetSlot( myList, 1, TRUE, &myString );
  432.    /* list is still ( a b c ), myItem is the string b now
  433.     with a use count of 2 */
  434.  
  435. ListInsertSlot *545*
  436.  
  437. Adds a slot to a C_list data item (thereby lengthening the list), assigns the given data item to the slot, and optionally increments the data item窶冱 use count.
  438.  
  439. Availability:  
  440.  
  441.  Interpreted XPrims, Compiled XPrims, XCode
  442.  
  443. Syntax:  
  444.  
  445.  #include "MacTypes.h"
  446.  #include "X_includes.h"
  447.  
  448.  void ListInsertSlot( list, index, use, item )
  449.  
  450.  C_list * list;     /* the list involved */
  451.  Nat4 index;      /* 0 based index to the slot */
  452.  Bool use;       /* TRUE = apply IncUse to the item */
  453.  C_object * item;    /* the data item to be inserted */
  454.  
  455. Example:  
  456.  
  457.  C_list * myList;
  458.  C_string * myString;
  459.    /* assume myList is ( a c ) */
  460.  myString = MakeC_string( "¥pb" );
  461.  ListInsertSlot( myList, 1, FALSE, myString );
  462.   /* list is now ( a b c ), the use parameter was FALSE
  463.     since the C_string is created with a use of 1 and
  464.     nothing else points to it */
  465.  
  466. ListSetLength *545*
  467.  
  468. Changes the number of slots in the given list. Slots can be added or deleted. This function does not adjust the use count on items in deleted slots. Slots that are added are initialized to NULL.
  469.  
  470. Availability:  
  471.  
  472.  Interpreted XPrims, Compiled XPrims, XCode
  473.  
  474. Syntax:  
  475.  
  476.  #include "MacTypes.h"
  477.  #include "X_includes.h"
  478.  
  479.  void ListSetLength( list, newLength )
  480.  
  481.  C_list * list;      /* the list involved */
  482.  Nat4 newLength;     /* total # of slots list should have */
  483.  
  484. Example:  
  485.  
  486.  C_list * myList; 
  487.    /* assume myList is ( a b c ) */
  488.  ListSetLength( myList, 6 );
  489.    /* list is now ( a b c NULL NULL NULL ) */    
  490.  
  491. ListSetSlot *546*
  492.  
  493. Sets the contents of the given slot, optionally decrements the use count on the data item that was in the slot, and optionally increments the use count on the data item that is set in the slot. 
  494.  
  495. Availability:  
  496.  
  497.  Interpreted XPrims, Compiled XPrims, XCode
  498.  
  499. Syntax:  
  500.  
  501.  #include "MacTypes.h"
  502.  #include "X_includes.h"
  503.  
  504.  void ListSetSlot( list, index, oldUse, newUse, item )
  505.  
  506.  C_list * list;     /* the list involved */
  507.  Nat4 index;       /* 0 based index to the slot */
  508.  Bool oldUse;      /* TRUE = apply DecUse to item in slot */
  509.  Bool newUse;      /* TRUE = apply IncUse to new item */
  510.  C_object * item;    /* the data item to set in the slot */
  511.  
  512. Example:  
  513.  
  514.  C_list * myList;
  515.  C_string * myString;
  516.    /* assume myList is ( a b c ) */
  517.  myString = MakeC_string( "¥px" );
  518.  ListSetSlot( myList, 1, TRUE, FALSE, myString );
  519.    /* myList is now ( a x c ), newUse = FALSE since myString is 
  520.       made with a use count of 1 */
  521.  
  522. ListStretch *546*
  523.  
  524. Expands the first list to include all items of the second list, and optionally increments the use count of the added items.
  525.  
  526. Availability:  
  527.  
  528.  Interpreted XPrims, Compiled XPrims, XCode
  529.  
  530. Syntax:  
  531.  
  532.  #include "MacTypes.h"
  533.  #include "X_includes.h"
  534.  
  535.  void ListStretch( list1, list2, use )
  536.  
  537.  C_list * list1;    /* the list to stretch */
  538.  C_list * list2;    /* the list whose elements will be added */
  539.  Bool use;      /* TRUE = apply IncUse to added items */
  540.  
  541. Example:  
  542.  
  543.  C_list * myList1, * myList2;
  544.    /* assume myList1 & 2 are (a b c) (d e) */
  545.  ListStretch( myList1, myList2, TRUE );
  546.    /* myList1 is now (a b c d e) myList2 is still (d e)
  547.    and the use counts of items d & e have been incremented */
  548.  
  549. MakeC_boolean *547*
  550.  
  551. Creates a C_boolean data item with a use count of one.
  552.  
  553. Availability:  
  554.  
  555.  Interpreted XPrims, Compiled XPrims, XCode
  556.  
  557. Syntax:  
  558.  
  559.  #include "X_includes.h"
  560.  
  561.  C_boolean * MakeC_boolean( value )
  562.  
  563.  Bool value;         /* FALSE = 0, TRUE = 1 */
  564.  
  565. Example:  
  566.  
  567.  C_boolean * myBool;
  568.  myBool = MakeC_boolean( FALSE );
  569.  
  570. MakeC_integer *547*
  571.  
  572. Creates a C_integer data item with a use count of one.
  573.  
  574. Availability:  
  575.  
  576.  Interpreted XPrims, Compiled XPrims, XCode
  577.  
  578. Syntax:  
  579.  
  580.  #include "X_includes.h"
  581.  
  582.  C_integer * MakeC_integer( value )
  583.  
  584.  Nat4 value;         /* a four byte signed long integer */
  585.  
  586. Example:  
  587.  
  588.  C_integer * myInt;
  589.  myInt = MakeC_integer( 12345 );
  590.  
  591. MakeC_list *548*
  592.  
  593. Creates a C_list data item with the given number of slots, with a use count of one. 
  594. Each slot is initialized to NULL.
  595.  
  596. Availability:  
  597.  
  598.  Interpreted XPrims, Compiled XPrims, XCode
  599.  
  600. Syntax:  
  601.  
  602.  #include "X_includes.h"
  603.  
  604.  C_list * MakeC_list( slots )
  605.  
  606.  Nat4 slots;     /* the # of slots to make in the list */
  607.  
  608. Example:  
  609.  
  610.  C_list * myList;
  611.  myList = MakeC_list( 10 );
  612.  
  613. MakeC_none *548*
  614.  
  615. Creates a C_none data item with a use count of one.
  616.  
  617. Availability:  
  618.  
  619.  Interpreted XPrims, Compiled XPrims, XCode
  620.  
  621. Syntax:  
  622.  
  623.  #include "X_includes.h"
  624.  
  625.  C_none * MakeC_none( )
  626.  
  627. Example:  
  628.  
  629.  C_none * myNone;
  630.  myNone = MakeC_none( );
  631.  
  632. MakeC_real *548*
  633.  
  634. Creates a C_real data item with a use count of one.
  635.  
  636. Availability:  
  637.  
  638.  Interpreted XPrims, Compiled XPrims, XCode
  639.  
  640. Syntax:  
  641.  
  642.  #include "X_includes.h"
  643.  
  644.  C_real * MakeC_real( value )
  645.  
  646.  Real10 value;         /* a ten byte floating point value */
  647.  
  648. Example:  
  649.  
  650.  C_real * myReal;
  651.  myReal = MakeC_real( 1.2345 );
  652.  
  653. MakeC_string *549*
  654.  
  655. Creates a C_string data item, with a use count of one, from a Pascal formatted string. Use StrFromText to create a C_string data item from a character string and a size.
  656.  
  657. Availability:  
  658.  
  659.  Interpreted XPrims, Compiled XPrims, XCode
  660.  
  661. Syntax:  
  662.  
  663.  #include "X_includes.h"
  664.  
  665.  C_string * MakeC_string( text )
  666.  
  667.  Nat1 * text;       /* address of size byte of Str255*/
  668.  
  669. Example:  
  670.  
  671.  C_string * myString;
  672.  myString = MakeC_string( (Nat1 *) "¥pYo Ho Ho !" );
  673.  
  674. MakeC_undefined *549*
  675.  
  676. Creates an C_undefined data item with a use count of one.
  677.  
  678. Availability:  
  679.  
  680.  Interpreted XPrims, Compiled XPrims, XCode
  681.  
  682. Syntax:  
  683.  
  684.  #include "X_includes.h"
  685.  
  686.  C_undefined * MakeC_undefined( );
  687.  
  688. Example:  
  689.  
  690.  C_undefined * myUndef;
  691.  myUndef = MakeC_undefined( );
  692.  
  693.  
  694. MakeC_Handle *550*
  695.  
  696. Creates a C_Handle data item with a use count of one.
  697.  
  698. Availability:  
  699.  
  700.  Interpreted XPrims, Compiled XPrims, XCode
  701.  
  702. Syntax:  
  703.  
  704.  #include "X_includes.h"
  705.  
  706.  C_Handle * MakeC_Handle( class, handle )
  707.  
  708.  Class class;         /* class of object pointed to */
  709.  Handle handle;        /* Macintosh handle */
  710.  
  711. Example:  
  712.  
  713.  Region ** myRegion;
  714.  C_Handle    * myHandle;
  715.   /* assume myRegion contains a handle to a Region */
  716.  myHandle = MakeC_Handle( C_REGION, myRegion);
  717.  
  718. MakeC_Point *550*
  719.  
  720. Creates a C_Point data item with a use count of one.
  721.  
  722. Availability:  
  723.  
  724.  Interpreted XPrims, Compiled XPrims, XCode
  725.  
  726. Syntax:  
  727.  
  728.  #include "QuickDraw.h"
  729.  #include "X_includes.h"
  730.  
  731.  C_Point * MakeC_Point( v, h )
  732.  
  733.  Int2 v;           /* vertical coordinate */
  734.  Int2 h;           /* horizontal coordinate */
  735.  
  736. Example:  
  737.  
  738.  C_Point * myPoint;
  739.  myPoint = MakeC_Point( 2, 4 );
  740.  
  741. MakeC_Ptr *551*
  742.  
  743. Creates a C_Ptr data item with a use count of one.
  744.  
  745. Availability:  
  746.  
  747.  Interpreted XPrims, Compiled XPrims, XCode
  748.  
  749. Syntax:  
  750.  
  751.  #include "X_includes.h"
  752.  
  753.  C_Ptr * MakeC_Ptr( class, pointer )
  754.  
  755.  Class class;         /* class of object pointed to */
  756.  Ptr pointer;         /* Macintosh pointer */
  757.  
  758. Example:  
  759.  
  760.  Region * myRegion;
  761.  C_Ptr    * myPtr;
  762.   /* assume myRegion contains a pointer to a Region */
  763.  myPtr = MakeC_Ptr( C_REGION, myRegion);
  764.  
  765. MakeC_Rect *551*
  766.  
  767. Creates a C_Rect data item with a use count of one.
  768.  
  769. Availability:  
  770.  
  771.  Interpreted XPrims, Compiled XPrims, XCode
  772.  
  773. Syntax:  
  774.  
  775.  #include "QuickDraw.h"
  776.  #include "X_includes.h"
  777.  
  778.  C_Rect * MakeC_Rect( top, left, bottom, right )
  779.  
  780.  Int2 top;         /* top vertical coordinate */
  781.  Int2 left;         /* left horizontal coordinate */
  782.  Int2 bottom;        /* bottom vertical coordinate */
  783.  Int2 right;         /* right horizontal coordinate */
  784.  
  785. Example:  
  786.  
  787.  C_Rect * myRect;
  788.  myRect = MakeC_Rect( 2, 4, 6, 8 );
  789.  
  790. MakeC_RGBColor *552*
  791.  
  792. Creates a C_RGBColor data item with a use count of one.
  793.  
  794. Availability:  
  795.  
  796.  Interpreted XPrims, Compiled XPrims, XCode
  797.  
  798. Syntax:  
  799.  
  800.  #include "QuickDraw.h"
  801.  #include "X_includes.h"
  802.  
  803.  C_RGBColor * MakeC_RGBColor( red, green, blue )
  804.  
  805.  Nat2 red;         /* red color */
  806.  Nat2 green;         /* green color */
  807.  Nat2 blue;         /* blue color */
  808.  
  809. Example:  
  810.  
  811.  C_RGBColor * myRGB;
  812.  myRGB = MakeC_RGBColor( 0x0001, 0xF000, 0x1234 );
  813.  
  814. Make_instance *552*
  815.  
  816. Creates a data item of a user defined class, with a use count of one.
  817.  
  818. Availability:  
  819.  
  820.  Interpreted XPrims, Compiled XPrims, XCode
  821.  
  822. Syntax:  
  823.  
  824.  #include "X_includes.h"
  825.  
  826.  C_object * Make_instance( classname )
  827.  
  828.  C_string * classname;       /* class name */
  829.  
  830. Example:  
  831.  
  832.  C_object * myInst;
  833.  C_string    * myClassName;
  834.   /* assume myClassName contains the name of a prograph class */
  835.  myInst = Make_instance( myClassName);
  836.  
  837. Member *553*
  838.  
  839. Determines whether a data item belongs to a particular class. Member returns TRUE if the data item窶冱 class or any of its ancestors is equal to the class specified. (Member is not to be confused with the THINK function member.)
  840.  
  841. Availability:  
  842.  
  843.  XCode
  844.  
  845. Syntax:  
  846.  
  847.  #include "X_includes.h"
  848.  
  849.  Bool Member(  object, class )
  850.  
  851.  C_object *object;    /* object to test */
  852.   Class      *class;    /* class to test */
  853.          /* address of class identifier */
  854.  
  855. Example:  
  856.  
  857.  C_object *myObject;
  858.  /* Member returns TRUE if myObject窶冱 class is */
  859.  /* a descendant of  C_number */
  860.  
  861.  if ( Member( myObject, &C_number__ ) )
  862.    ...
  863.  
  864. New *553*
  865.  
  866. Creates an data item of the specified class. New sets the use count of the new data item to one. (New is not to be confused with the THINK function new.)
  867.  
  868. If New is used to create an instance of a user defined class the attributes of the instance will not be initialized; that is, they will contain garbage values. To create an instance of a user defined class which is initialized to its default value make a deep copy of the default instance with the Duplicate function. The default instance of a user defined class can be found in a global variable of the form C_class__A_default. 
  869.  
  870. Availability:  
  871.  
  872.  XCode
  873.  
  874. Syntax:  
  875.  
  876.  #include "X_includes.h"
  877.  
  878.  C_object *New( class )
  879.  
  880.   Class *class;      /* class of new object */
  881.          /* address of class identifier */
  882.  
  883.  
  884. Example:  
  885.  
  886.  C_Person *myPerson;
  887.  /* Assume the class C_Person has been defined to have */
  888.  /* three attributes */
  889.  
  890.  myPerson = (C_Person *) New( &C_Person__ );       
  891.  (**myPerson).name = MakeC_string( "¥PFred Nitnee" );
  892.  (**myPerson).age    = MakeC_integer( 32 );
  893.  (**myPerson).address = NULL;
  894.   ...
  895.  
  896. NewN *554*
  897.  
  898. Used to create data items of class C_list, C_string or C_ABlock. All of these classes have a four-byte length field directly after the use field. The length field is set by NewN.
  899.  
  900. Availability:  
  901.  
  902.  XCode
  903.  
  904. Syntax:  
  905.  
  906.  #include "X_includes.h"
  907.  
  908.  C_object *NewN( class, length )
  909.  
  910.   Class *class;      /* class of new object */
  911.          /* address of class identifier */
  912.  Nat4 length;      /* for C_list:   number of slots */
  913.          /* for C_string:   number of characters */
  914.  
  915. Example:  
  916.  
  917.  C_list *myList;
  918.  /* Create a list with 12 slots */
  919.   
  920.  myList = (C_list *) NewN( &C_list__, 12 );
  921.  ...
  922.  
  923. NumToStr *554*
  924.  
  925. Converts a number to a C_string, and if stretch is TRUE, adds it to an existing C_string passed in myStr; otherwise, it creates a new C_string, with a use count of one.
  926.  
  927. Availability:  
  928.  
  929.  Interpreted XPrims, Compiled XPrims, XCode
  930.  
  931. Syntax:  
  932.  
  933.  #include "X_includes.h"
  934.  #include "MacTypes.h"
  935.  
  936.  void NumToStr( number, stretch, myStr )
  937.  
  938.  Int4 number;        /* number to convert */
  939.  Bool stretch;        /* stretch or create, TRUE or FALSE */
  940.  C_string ** myStr;      /* C_string input or to return */
  941.  
  942. Example:  
  943.  
  944.  C_string *myStr;
  945.    /* assume myStr has the value "The number is " */
  946.  NumToDtxt( 12345, TRUE, &myStr );
  947.    /* myStr is now "The Number is 12345" */
  948.  
  949. ResToStr *555*
  950.  
  951. Retrieves a resource of type 'STR ' from the current resource file and converts it to a C_string. If stretch is TRUE, it is added to an existing C_string passed in string; otherwise it creates a new C_string with a use count of one.
  952.  
  953. Availability:  
  954.  
  955.  Interpreted XPrims, Compiled XPrims, XCode
  956.  
  957. Syntax:  
  958.  
  959.  #include "X_includes.h"
  960.  #include "MacTypes.h"
  961.  
  962.  void ResToStr( resNum, stretch, string )
  963.  
  964.  Int2 resNum;       /* STR resource ID number */
  965.  Bool stretch;       /* stretch or create, TRUE or FALSE */
  966.  C_string **string;     /* C_string input or to return */
  967.  
  968. Example:  
  969.  
  970.  C_string *myStr;
  971.  ResToStr( 128, FALSE, &myStr);
  972.    /* the value of myStr is now whatever STR resource 128 is */
  973.  
  974. StrFromText *555*
  975.  
  976. Creates a C_string data item, with a use count of one, from a character string and a size. Use MakeC_string to create a C_string data item from a Pascal formatted string.
  977.  
  978. Availability:  
  979.  
  980.  Interpreted XPrims, Compiled XPrims, XCode
  981.  
  982. Syntax:  
  983.  
  984.  #include "X_includes.h"
  985.  
  986.  C_string * StrFromText( text, size )
  987.  
  988.  Nat1    * text;      /* address of 1st character of text */
  989.  Nat4    size;       /* number of characters in text */
  990.  
  991. Example:  
  992.  
  993.  C_string * myString;
  994.  myString = StrFromText( (Nat1 *) "Yo Ho Ho !", 10 );
  995.  
  996. StrJoin *556* 
  997.  
  998. Expands the C_string to include the second C_string.
  999.  
  1000. Availability:  
  1001.  
  1002.  Interpreted XPrims, Compiled XPrims, XCode
  1003.  
  1004. Syntax:  
  1005.  
  1006.  #include "X_includes.h"
  1007.  
  1008.  void StrJoin( string1, string2)
  1009.  
  1010.  C_string * string1;     /* the string to stretch */
  1011.  C_string * string2;     /* the string which will be added */
  1012.  
  1013. Example:  
  1014.  
  1015.  C_string * myString1, * myString2;
  1016.   /* assume myString1 is "Hello " and myString2 is "sailor!" */
  1017.  StrJoin( myString1, myString2 );
  1018.   /* myString1 is now "Hello sailor!" myString2 is unchanged */
  1019.  
  1020. StrStretchString *556*
  1021.  
  1022. Expands a C_string data item to include arbitrary text.
  1023.  
  1024. Availability:  
  1025.  
  1026.  Interpreted XPrims, Compiled XPrims, XCode
  1027.  
  1028. Syntax:  
  1029.  
  1030.  #include "MacTypes.h"
  1031.  #include "X_includes.h"
  1032.  
  1033.  void StrStretchString( string, text, textSize)
  1034.  
  1035.  C_string * string;      /* the string to stretch */
  1036.  Nat1 * text;        /* address of 1st char of text to add */
  1037.  Nat4 textSize;       /* # of bytes of text to add */
  1038.  
  1039. Example:  
  1040.  
  1041.  C_string * myStr;
  1042.  Nat1 * myText;
  1043.    /* assume myStr is "Hello " myText points to "sailor!"
  1044.  StrStretchString( myStr, myText, 7 );
  1045.    /* myString is now "Hello sailor!", myText is unchanged */
  1046.  
  1047. StrToPstring *557*
  1048.  
  1049. Copies a maximum of max bytes from a C_string into a given character array, setting the size byte appropriately.
  1050.  
  1051. Availability:  
  1052.  
  1053.  Interpreted XPrims, Compiled XPrims, XCode
  1054.  
  1055. Syntax:  
  1056.  
  1057.  #include "MacTypes.h"
  1058.  #include "X_includes.h"
  1059.  
  1060.  void StrToPstring( dtxt, string, max )
  1061.  
  1062.  C_string * string;     /* the string to copy */
  1063.  Nat1 * Pstring;      /* address of the array */
  1064.  Nat2 max;        /* number of bytes available */
  1065.  
  1066. Example:  
  1067.  
  1068.  C_string *myStr;
  1069.  Str255 myStr255;
  1070.    /* assume myStr is "slithy toves" */
  1071.  StrToPstring( myStr, (Nat1 *) myStr255, 255 );
  1072.    /* myStr255 is now "¥pslithy toves" myStr is unchanged */
  1073.